Fixes Gemini API parse issue by converting nullable type arrays to single types in tool schemas#5530
Merged
angiejones merged 1 commit intoblock:mainfrom Nov 2, 2025
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the handling of nullable type arrays in Google API tool formatting. Previously, when a tool parameter had a type array like ["string", "null"], the entire array was being cloned instead of being processed to extract the non-null type.
Key Changes
- Modified
process_mapfunction to callprocess_valuefor all non-special-cased keys, ensuring type arrays are properly converted to single types - Added comprehensive test coverage for nullable type conversion in tool parameters
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
thank you so much for this fix! can you sign the DCO: |
angiejones
approved these changes
Nov 2, 2025
… arrays to single types in tool schemas Fixes issue where Gemini API rejected tool schemas containing type arrays like ["string", "null"]. Gemini's API expects type fields to be single string values, not arrays. The root cause was in the process_map function, which was cloning values for most keys instead of calling process_value. The process_value function already had logic to convert type arrays to single values, but it was only being called for specific keys (properties, items, anyOf, allOf), not for the type key itself. This fix changes the default case in process_map to call process_value, which properly converts type arrays like ["string", "null"] to "string" (extracting the non-null type). Signed-off-by: Paul Silvis <paulsilvis@gmail.com>
6a679c3 to
277391a
Compare
michaelneale
added a commit
that referenced
this pull request
Nov 3, 2025
* main: Fixes Gemini API parse issue by converting nullable type arrays to single types in tool schemas (#5530) Troubleshooting diagnostics doc (#5526) fix link to Ollama FAQ (#5531) docs: remove speech-mcp (#5514) fix: adds ProviderRetry to openai provider (#5518) docs: extensions directory minor updates (#5466) Docs/json recipe support (#5492) docs: recipe buttons (#5507) Improve system theme detection and fallback (#5427) [Autovisualiser] remove unnecessary content from mermaid HTML template (#5505) Improve subagents docs (#5484) FIX: prefer linux in WSL and add INSTALL_OS override for CLI (#5215) Propagate session ID in LLM and MCP requests (#5165) feat: YT Short for Canva MCP + goose (#5495)
katzdave
added a commit
that referenced
this pull request
Nov 3, 2025
…se into dkatz/manual-compact-fix-usage * 'dkatz/manual-compact-fix-usage' of github.com:block/goose: (35 commits) Fix image processing (#5544) docs: AI attribution for PRs (#5547) chore(tests/mcp): testing for MCP sampling (#5456) docs: adding HOWTOAI.md (#5533) added configuration content, also added signoff, fix merging issue with another commit by creating a clean branch. removed and closed commits that caused signoff issues. (#5519) Fixes Gemini API parse issue by converting nullable type arrays to single types in tool schemas (#5530) Troubleshooting diagnostics doc (#5526) fix link to Ollama FAQ (#5531) docs: remove speech-mcp (#5514) fix: adds ProviderRetry to openai provider (#5518) docs: extensions directory minor updates (#5466) Docs/json recipe support (#5492) docs: recipe buttons (#5507) Improve system theme detection and fallback (#5427) [Autovisualiser] remove unnecessary content from mermaid HTML template (#5505) Improve subagents docs (#5484) FIX: prefer linux in WSL and add INSTALL_OS override for CLI (#5215) Propagate session ID in LLM and MCP requests (#5165) feat: YT Short for Canva MCP + goose (#5495) Change Recipes Test Script (#5457) ...
|
Thanks. When will this fix be available in the application? @psilvis |
katzdave
added a commit
that referenced
this pull request
Nov 4, 2025
* 'main' of github.com:block/goose: (21 commits) Manual compaction counting fix + cli cleanup (#5480) chore(deps): bump prismjs and react-syntax-highlighter in /ui/desktop (#5549) fix: remove qwen3-coder from provider/mcp smoke tests (#5551) fix: do not build unsigned desktop app bundles on every PR in ci. add manual option. (#5550) fix: update Husky prepare script to v9 format (#5522) Fix 404 for responsible coding guide (#5543) fix hermit `text file busy` issues on linux (#5372) Fix image processing (#5544) docs: AI attribution for PRs (#5547) chore(tests/mcp): testing for MCP sampling (#5456) docs: adding HOWTOAI.md (#5533) added configuration content, also added signoff, fix merging issue with another commit by creating a clean branch. removed and closed commits that caused signoff issues. (#5519) Fixes Gemini API parse issue by converting nullable type arrays to single types in tool schemas (#5530) Troubleshooting diagnostics doc (#5526) fix link to Ollama FAQ (#5531) docs: remove speech-mcp (#5514) fix: adds ProviderRetry to openai provider (#5518) docs: extensions directory minor updates (#5466) Docs/json recipe support (#5492) docs: recipe buttons (#5507) ...
fbalicchia
pushed a commit
to fbalicchia/goose
that referenced
this pull request
Nov 7, 2025
…ngle types in tool schemas (block#5530) Signed-off-by: Paul Silvis <paulsilvis@gmail.com> Signed-off-by: fbalicchia <fbalicchia@gmail.com>
BlairAllan
pushed a commit
to BlairAllan/goose
that referenced
this pull request
Nov 29, 2025
…ngle types in tool schemas (block#5530) Signed-off-by: Paul Silvis <paulsilvis@gmail.com> Signed-off-by: Blair Allan <Blairallan@icloud.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue where Gemini API rejected tool schemas containing type arrays like ["string", "null"]. Gemini's API expects type fields to be single string values.
The root cause was in the process_map function, which was cloning values for most keys instead of calling process_value. The process_value function already had logic to convert type arrays to single values, but it was only being called for specific keys (properties, items, anyOf, allOf), not for the type key itself.
Type of Change
Testing
I manually reproduced the issue using Gemini 2.5 Flash as the provider, then tested again with this change to verify the fix. This PR also includes a unit test.
Related Issues
Relates to #5506
Screenshots/Demos (for UX changes)
Before:

After:
